<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="Author" contect="http://www.webqin.net">
    <title>忘记密码</title>
    <link rel="shortcut icon" href="images/favicon.ico"/>
    <link type="text/css" href="__STATIC__/before/style/css.css" rel="stylesheet"/>

    <style>
        #user111 {
            text-indent: 1em;
            font-size: 16px;
        }

        .error {
            display: block;
            margin: 2% 0 0 27%;
            font-size: 16px;
            color: red;
        }

        .sel-yzyx input + input {
            width: 120px;
            height: 30px;
            line-height: 30px;
            border: #ddd 1px solid;
            background: #f1f1f1;
            text-align: center;
            cursor: pointer;
            font-size: 14px;
            color: #666;
        }
        input.verity-code{
            height: 26px;
            margin:8px 0 0 22%;
            border: 1px solid #ddd;
            text-indent: 1em;
        }
    </style>
</head>

<body>

<div class="content">
    <div class="web-width">
        <div class="for-liucheng">
            <div class="liulist for-cur"></div>
            <div class="liulist"></div>
            <div class="liulist"></div>
            <div class="liutextbox">
                <div class="liutext for-cur"><em>1</em><br/><strong>验证身份</strong></div>
                <div class="liutext"><em>2</em><br/><strong>设置新密码</strong></div>
                <div class="liutext"><em>3</em><br/><strong>完成</strong></div>
            </div>
        </div><!--for-liucheng/-->
        <form action="" method="post" class="forget-pwd">
            <dl>
                <dt>验证方式：</dt>
                <dd>
                    <select class="selyz">

                        <option value="1"> 已验证邮箱</option>
                    </select>
                </dd>
                <div class="clears"></div>
            </dl>
            <dl>
                <dt>用户名：</dt>
                <dd><input type="text" id="user111" name="name"/></dd>
                <p id="message111" class=""></p>
                <div class="clears"></div>
            </dl>
            <dl class="sel-yzyx">
                <dt>已验证邮箱：</dt>
                <dd><input type="email" value="" name="email"/>
                    <input type="button" value="获取邮箱验证码">

                </dd>
                <p style="margin:4% 0 0 21%;color: green">邮箱若没有注册过填写后自动注册更新</p>
                <input type="text" placeholder="请填写验证码" class="verity-code" name="verity-code">

                <div class="clears"></div>
            </dl>
            <div class="subtijiao"><input type="submit" value="提交"/></div>
        </form><!--forget-pwd/-->
    </div><!--web-width/-->
</div><!--content/-->

</body>
<script src="__STATIC__/before/js/jquery-1.8.3.min.js"></script>


<script>
    var oDd = document.getElementsByClassName('sel-yzyx')[0].getElementsByTagName('dd')[0];
    var wait=60;
    user111.onblur = function () {
        var name = this.value;
        // console.log(name);
        $.ajax({
            url: "{:url('Index/ajaxUser')}",
            data: {"name": name},
            type: 'post',
            success: function (data) {
                // console.log(data);
                if (data == 1) {
                    message111.className = "";
                    message111.innerText = "";
                } else {
                    message111.innerText = "用户名尚未注册!";
                    message111.className = "error";
                }

            }
        });
    }
    oDd.getElementsByTagName('input')[1].onclick = function () {
        var email = oDd.getElementsByTagName('input')[0].value;
        var name = user111.value;
        $.ajax({
            url: "{:url('Index/findpwd')}",
            data: {
                "email": email,
                "name": name
            },
            type: 'post',
            success: function (data) {
                        // console.log(data);
                if (data == 1) {

                    time(oDd.getElementsByTagName('input')[1]);
                }
            }
        });

    };
        function time(o) {
                // console.log(1);
            if (wait == 0) {
                o.removeAttribute("disabled");
                o.value="免费获取验证码";
                wait = 60;
            } else {

                o.setAttribute("disabled", true);
                o.value="重新发送(" + wait + ")";
                wait--;
                setTimeout(function() {
                        time(o)
                    },
                    1000)
            }
        }



</script>

</html>
